<div id="top_nav">
    <span id="here_area">当前位置：系统&nbsp;>&nbsp;账号管理&nbsp;>&nbsp;教师账号注册</span>
</div>
<div>
    <div class="layui-form-item">
        <label class="layui-form-label">教师工号</label>
        <div class="layui-input-inline">
            <input type="text" name="username" lay-verify="title" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">教师姓名</label>
        <div class="layui-input-inline">
            <input type="text" name="name" lay-verify="title" autocomplete="off"
                   class="layui-input">
        </div>
        <label class="layui-form-label">教师性别</label>
        <div class="layui-input-inline">
            <input type="text" name="sex" lay-verify="title" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password" lay-verify="title" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-inline">
            <input type="text" name="phone" lay-verify="title" autocomplete="off"
                   class="layui-input">
        </div>
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-inline">
            <input type="text" name="mail" lay-verify="title" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" style="margin-left: 45px">
        <div class="layui-input-inline">
            <button id="select" class="layui-btn layui-btn-normal">提交</button>
        </div>
    </div>
</div>
<script>
    $("#select").click(function () {
        var username = $("input[name=username]").val();
        var name = $("input[name=name]").val();
        var sex = $("input[name=sex]").val();
        var password = $("input[name=password]").val();
        var phone = $("input[name=phone]").val();
        var mail = $("input[name=mail]").val();
        $.ajax({
            url: "Admin/regist",
            type: "post",
            data: {
                "username": username,
                "name": name,
                "sex": sex,
                "password": password,
                "phone": phone,
                "mail": mail,
                "role": "ROLE_TEACHER"
            },
            success: function () {
                alert("注册成功");
                $.ajax({
                    url: "Admin/tearegist",
                    type: "get",
                    success: function (data) {
                        $("#main").html(data)
                    }
                });
            }
        });
    });
</script>